package sample.templates;

public class PriceVisitor implements Visitor {
	private double alSum;
	private double pSum;
	private double gSum;
	private double cSum;

	@Override
	public void visit(VAluminum al) {
		double v = al.weight() * al.value();
		System.out.println("Value of Aluminum=" + v);
		alSum += v;
	}

	@Override
	public void visit(VGlass al) {
		double v = al.weight() * al.value();
		System.out.println("Value of Glass=" + v);
		alSum += v;
	}

	@Override
	public void visit(VCardboard al) {
		double v = al.weight() * al.value();
		System.out.println("Value of Cardboard=" + v);
		alSum += v;
	}

	@Override
	public void visit(VPaper al) {
		double v = al.weight() * al.value();
		System.out.println("Value of Paper=" + v);
		alSum += v;
	}

	void total() {
		System.out.println("Total Aluminum $" + alSum + "\n" + "Total Paper:$"
				+ pSum + "\n" + "Total Paper:$" + gSum + "\n"
				+ "Total Cardboard:$" + cSum);
	}
}
